let _ = {
    parse(str) {
        let obj = {}
        str.split('&').forEach(r => {
            let kv = r.split('=')
            obj[kv[0]] = kv[1]
        })
        return obj
    },
    stringify: obj => Object.keys(obj).map(key => [key, obj[key]].join('=')).join('&'),
    get(url, data) {
        return fetch([url, this.stringify(data)].join('?')).then(res => res.json())
    },
    parseFullTime(val, callback) {
        let d = new Date(val)
        let yy = d.getFullYear()
        let mm = this.repair0(d.getMonth() + 1)
        let dd = this.repair0(d.getDate())
        let hh = this.repair0(d.getHours())
        let mi = this.repair0(d.getMinutes())
        let ss = this.repair0(d.getSeconds())
        let yymmdd = [yy, mm, dd].join('/')
        let hhmiss = [hh, mi, ss].join(':')
        let weekday = `星期${'日一二三四五六'[d.getDay()]}`
        let ms = d.getTime()
        return callback({
            yymmdd, hhmiss, weekday, ms
        })
    },
    parseYMD(val) {
        return this.parseFullTime(val, res => res.yymmdd)
    },
    parseHMS(val) {
        return this.parseFullTime(val, res => res.hhmiss)
    },
    parseWeek(val) {
        return this.parseFullTime(val, res => res.weekday)
    },
    parseHMSWeek(val) {
        return this.parseFullTime(val, res => res.yymmdd + ' ' + res.weekday)
    },
    parseMS(val) {
        return this.parseFullTime(val, res => res.ms)
    },
    repair0(val) {
        val = val + ''
        return val[1] ? val : ('0' + val)
    }
}